package com.fintech.third.quartz;

import org.quartz.SchedulerException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.ContextRefreshedEvent;

import com.fintech.third.task.MoXieAlipayTask;
import com.fintech.third.task.MoXieCarrierTask;
import com.fintech.third.task.MoXieFundTask;
import com.marvels.common.utils.MarvelsLogUtil;

@Configuration
public class ApplicationStartQuartzJobListener implements ApplicationListener<ContextRefreshedEvent>{

	@Autowired
    private QuartzService quartzService;
	
	@Override
	public void onApplicationEvent(ContextRefreshedEvent event) {
//		try {
//			quartzService.createScheduleJob("MoXieAlipayTask", "0 */2 * * * ?", MoXieAlipayTask.class);
//		} catch (SchedulerException e) {
//			MarvelsLogUtil.getInstance().error(">>>>>>moXieAlipayTask监听启动异常:",e);
//		}
//		try {
//			quartzService.createScheduleJob("MoXieCarrierTask", "0 */2 * * * ?", MoXieCarrierTask.class);
//		} catch (SchedulerException e) {
//			MarvelsLogUtil.getInstance().error(">>>>>>moXieCarrierTask监听启动异常:",e);
//		}
//		try {
//			quartzService.createScheduleJob("MoXieFundTask", "0 */2 * * * ?", MoXieFundTask.class);
//		} catch (SchedulerException e) {
//			MarvelsLogUtil.getInstance().error(">>>>>>moXieFundTask监听启动异常:",e);
//		}
	}

}
